#include<stdio.h>

double mypow1(double x, int n)
{
  double ret;
  if (n > 1){
    if (n % 2 == 0){
      ret = mypow1(x, n / 2) * mypow1(x, n / 2);
    }
    else
    {
      ret = mypow1(x, n / 2) * mypow1(x, n / 2) * x;
    }
  }
  else{
    return x;
  } 
  
  return ret;
}


double mypow2(double x, int n)
{
  int start = 0;
  int i = 1;
  double ret1 = x;
  double ret = 1;

  while (start != n){
    while (start + i * 2 < n){
      ret1 *= ret1;
      i *= 2;
    }
    ret *= ret1;
    ret1 = x;
    start = start + i;
    i = 1;
  }

  return ret;
}

int main()
{
  printf("%f\n", mypow2(2, 15));
}
